/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}


/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	'use strict';

	var _boneTime = __webpack_require__(2);

	var _boneTime2 = _interopRequireDefault(_boneTime);

	var _com = __webpack_require__(1);

	var _com2 = _interopRequireDefault(_com);

	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

	var components = (0, _com2.default)(['HeaderLayout', 'HeaderDock', 'LayoutMain', 'LayoutBox', 'LayoutSideMenu', 'TabsSide', 'TabsItemSide', 'Icon', 'List', 'ListItem', 'Product2', 'ShoppingDock', 'Btn']);

	//cvxd
	new Vue({
		el: '#app',
		components: components,
		data: function data() {
			return {
				data: [{ data: [], show: false }, { data: [], show: false }, { data: [], show: false }, { data: [], show: false }, { data: [], show: false }, { data: [], show: false }, { data: [], show: false }],
				//data: [{data:[]},{data:[]},{data:[]},{data:[]},{data:[]}],
				//data: [],
				request: null,
				total: 0,
				lock: false,
				types: {
					1: '早餐',
					2: '中餐',
					3: '晚餐'
				}
			};
		},

		created: function created() {
			var haha = ['一', '二', '三', '四', '五', '六', '日'];
			var priceall = 0;

			//
			for (var i = 0; i < DATE.length; i++) {
				//var day = new Date(DATE[i]).getDay();
				var datee = new _boneTime2.default(DATE[i]);
				this.data[i].show = true;
				this.data[i].date = '周' + haha[datee.obj.getDay() - 1] + '(' + datee.format('MM月dd日') + ')';

				for (var n = 0; n < PRODUCTS.length; n++) {
					if (PRODUCTS[n].date == DATE[i]) {
						PRODUCTS[n].name += '(' + this.types[PRODUCTS[n].type] + ')';
						this.data[i].data.push(PRODUCTS[n]);
						priceall += PRODUCTS[n].price * PRODUCTS[n].amount;
					}
				}
			}

			this.total = PRODUCTS.length;

			for (var i = 0; i < this.data.length; i++) {
				if (this.data[i].data.length == 0) {
					this.data[i].empty = true;
				} else {
					this.data[i].empty = false;
				}
			}
		},
		events: {},
		methods: {
			pay: function pay() {
				var _that = this;
				if (this.lock) return;
				/*
	   if(this.total < 2*DATE.length){
	   	bone.dialog.init('速派友情提醒', '您还未选满本周的商品，请在全部选购完成后提交订单').ok(function(){
	   					return true;
	   				});
	   		return;
	   }*/

				this.lock = true;
				$.ajax({
					url: SITE_URL + '/order/save/' + $('#code').val(),
					type: 'post',
					success: function success(data) {
						_that.loading = false;
						_that.lock = false
						bone.dialog.init('友情提醒', data.msg).ok(function () {
							if (!data.code) {} else {

								window.location = SITE_URL + '/order/detail/id/' + data.data;
							}
							return true;
						});
					},
					error: function error() {
						alert('网络发生错误，请重试');
					}
				});
			},
			clean: function clean() {

				bone.dialog.init('友情提醒', '确定清空购物车？', {
					buttons: 'double'
				}).ok(function () {
					$.ajax({
						url: SITE_URL + '/shoppingcart/clear',
						type: 'get',
						success: function success(data) {
							if (data.code) {
								window.location.reload();
							} else {
								alert(data.msg);
							}
						},
						error: function error() {
							//alert('网络错误，请重试');
						}

					});
					return true;
				}).no(function () {
					return true;
				});
			},
			delete: function _delete(pra) {
				this.request = $.ajax({
					url: SITE_URL + '/shoppingcart/delete',
					data: {
						id: pra.id
					},
					type: 'post',
					success: function success(data) {
						if (data.code) {
							window.location.reload();
						} else {
							bone.dialog.init('速派友情提醒', data.msg).ok(function () {
								return true;
							});
						}
					},
					error: function error() {
						//alert('网络错误，请重试');
					}

				});
				return;
			},
			buy: function buy(pra) {
				if (this.request) {
					this.request.abort();
				}
				var _this = this;

				if (pra.counter.val == 0) {

					this.request = $.ajax({
						url: SITE_URL + '/shoppingcart/delete',
						data: {
							id: pra.id
						},
						type: 'post',
						success: function success(data) {
							if (data.code) {
								window.location.reload();
							} else {
								bone.dialog.init('速派友情提醒', data.msg).ok(function () {
									return true;
								});
							}
						},
						error: function error() {
							//alert('网络错误，请重试');
						}

					});
					return;
				}

				this.request = $.ajax({
					url: SITE_URL + '/shoppingcart/updatecart',
					data: {
						id: pra.id,
						amount: pra.counter.val
					},
					type: 'post',
					success: function success(data) {
						if (data.code) {
							_this.total = data.data;
						} else {
							bone.dialog.init('速派友情提醒', data.msg).ok(function () {
								return true;
							});
						}
					},
					error: function error() {
						//alert('网络错误，请重试');
					}

				});
			}
		}
	});

/***/ },
/* 1 */
/***/ function(module, exports) {

	"use strict";

	Object.defineProperty(exports, "__esModule", {
		value: true
	});

	exports.default = function (components) {

		var res = {};
		for (var i = 0; i < components.length; i++) {
			res[components[i]] = Bone[components[i]];
		}
		return res;
	};

/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {

	(function() {
	  /**
	   * @param {str} yyyy-mm-dd | yyyy-m-d | yyyy-mm-dd hh:mm:ss
	   */
	  function Time(str) {
	    this.obj = null //原生JS DATE对象
	    this.year = 0
	    this.month = 0
	    this.date = 0
	    this.hour = 0
	    this.minute = 0
	    this.second = 0

	    this.init(str)
	  }

	  /**
	   * 初始化日期数据
	   * @param {String} str yyyy-mm-dd | yyyy-m-d | yyyy-mm-dd hh:mm:ss
	   *                     yyyy/mm/dd | yyyy/m/d | yyyy/mm/dd hh:mm:ss
	   */
	  Time.prototype.init = function(str) {

	    if(typeof str == 'string'){
	      var d = str.split(' ')
	      var d1 = d[0].split('-')

	      if (d1.length === 1) {
	        d1 = d[0].split('/')
	      }

	      this.year = parseInt(d1[0])
	      this.month = parseInt(d1[1])
	      this.date = parseInt(d1[2])

	      if (d[1]) {
	        var d2 = d[1].split(':')
	        this.hour = parseInt(d2[0])
	        this.minute = parseInt(d2[1])
	        this.second = parseInt(d2[2])
	      }

	      this.obj = new Date(this.year, this.month - 1, this.date, this.hour, this.minute, this.second)
	    } else {
	      if(str instanceof Date){
	        this.obj = str
	      } else {
	        this.obj = new Date()
	      }
	      this.year = this.obj.getFullYear()
	      this.month = this.obj.getMonth()+1
	      this.date = this.obj.getDate()
	      this.hour = this.obj.getHours()
	      this.minute = this.obj.getMinutes()
	      this.second = this.obj.getSeconds()
	    }
	  }

	  /**
	   * 比较日期是否相等
	   * @param {Time} aim 对比的time对象
	   * @param {String} min 对比的最小精确单位
	   */
	  Time.prototype.equal = function(aim, min) {
	    var m = min || 'date'
	    var result = false

	    switch (m) {
	      case 'date':
	        {
	          if (this.year === aim.year && this.month === aim.month && this.date === aim.date) {
	            result = true
	            break
	          }
	        }
	      default:
	        {
	          result = false
	        }
	    }

	    return result

	  }

	  /**
	   * @param {format} yy-mm-dd hh:mm:ss
	   */
	  Time.prototype.format = function(format) {
	    function filter(num) {
	     return (Array(2).join('0') + num).slice(-2);
	    }

	    var result = format.replace('yyyy', this.year)
	    result = result.replace('MM', filter(this.month))
	    result = result.replace('dd', filter(this.date))
	    result = result.replace('HH', filter(this.hour))
	    result = result.replace('mm', filter(this.minute))
	    result = result.replace('ss', filter(this.second))

	    return result
	  }

	  Time.prototype.getTime = function() {
	    return this.obj.getTime()
	  }

	  /**
	   * 转换时间
	   * @param {param} Mon|Tues|..|Sun|+10days|-10days|2017year|9month|11date|11hour|11min|11seconds
	   * @return Time Object
	   */
	  Time.prototype.transfer = function(param){
	    var base = new Date(this.obj.getTime())
	    var d = {
	          day : base.getDay()==0?7:base.getDay(),
	          date : base.getDate(),
	          month : base.getMonth(),
	          year : base.getFullYear(),
	          date: base.getDate(),
	          hours: base.getHours(),
	          minutes: base.getMinutes(),
	          seconds: base.getSeconds()
	        },
	        driver = filter(param),
	        week = {
	          'Mon': 1,
	          'Tues': 2,
	          'Wed': 3,
	          'Thur': 4,
	          'Fri': 5,
	          'Sat': 6,
	          'Sun': 7
	        },
	        funcs = {
	          'year': 'setFullYear',
	          'month': 'setMonth',
	          'date': 'setDate',
	          'hours': 'setHours',
	          'minutes': 'setMinutes',
	          'seconds': 'setSeconds'
	        }

	    switch(driver.mode){
	      case 'Mon': case 'Tues': case 'Wed': case 'Thur': case 'Fri': case 'Sat': {
	        base.setDate(d.date - d.day + week[driver.mode])
	        return new Time(base)
	        break;
	      }
	      case 'Sun': {
	        base.setDate(d.date + (7-d.day))
	        return new Time(base)
	        break;
	      }
	      case 'days': {
	        base.setDate(d.date + driver.value)
	        return new Time(base)
	        break;
	      }
	      case 'year': case 'month': case 'date': case 'hours': case 'minutes': case 'seconds': {

	        if(driver.prefix === '+' || driver.prefix === '-'){

	          base[funcs[driver.mode]](d[driver.mode] + driver.value)
	        }  else {
	          base[funcs[driver.mode]](driver.value)
	        }

	        return new Time(base)
	        break;
	      }
	      default:{
	        return this
	      }
	    }

	    function filter(str){
	      var prefix = str.match(/^\+|\-/),
	          mode = str.match(/[a-zA-Z]+/)

	      return {
	        prefix: prefix?prefix[0]:'',
	        mode: mode?mode[0]:'',
	        value: parseInt(str)
	      }
	    }

	    return this
	  }


	  if (true) {
	    module.exports = Time
	  } else {
	    window.bonetime = Time
	  }

	})()


/***/ }
/******/ ]);
